(function($, doc) {
	$.ready(function() {
		var state = app.getState();
		var uid = state.user_id;
		var chatnum = localStorage.getItem('chatnum' + uid) || 0;
		var chatnumEl = document.querySelector('#chatnum');
		if(chatnum > 0) {
			chatnumEl.style.display = '';
			chatnumEl.innerHTML = chatnum;
		} else {
			chatnumEl.style.display = 'none';
		}
		$('.mui-bar-tab').on('tap', 'a', function(e) {
			var targetTab = this.getAttribute('href');
			location.href = targetTab;
		});
		$('#topPopover').on('tap', 'a', function(e) {
			var targetTab = this.getAttribute('href');
			location.href = targetTab;
		});
		/*
		doc.querySelector('#mainsearchbtn').addEventListener('tap', function() {
			location.href = 'pages/public/search.html';
		});*/
	});

}(mui, document));